package com.leadingsoft.pwxk.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.leadingsoft.pwxk.converter.LicenseInfoConverter;
import com.leadingsoft.pwxk.dto.LicenseInfoDto;
import com.leadingsoft.pwxk.model.LicenseInfo;
import com.leadingsoft.pwxk.service.LicenseInfoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@Api(description = "获取发证后-许可证信息类")
@RequestMapping("api/licenseInfo")
public class LicenseInfoController {

	@Autowired
	LicenseInfoService licenseInfoService;

	@Autowired
	LicenseInfoConverter licenseInfoConverter;

	@GetMapping(path = "{dataid}")
	@ResponseStatus(code = HttpStatus.OK)
	@ApiOperation("获取发证后-许可证详细信息-接口")
	public LicenseInfoDto get(@PathVariable(value = "dataid") String dataId) {
		LicenseInfo licenseInfo = licenseInfoService.getOne(dataId);
		return licenseInfoConverter.toDtoActual(licenseInfo);
	}
}
